﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;


public class ExecuteProcedure : DAO
{
    public string ErrorMessage = "";

    public int run(string sprocName, SqlParameter[] parameters)
    {
        Debug.Assert(sproc == null);
        sproc = new StoredProcedure(sprocName, parameters);
        int flag = sproc.Run();
        this.ErrorMessage = sproc.ErrorMessage;
        sproc.Dispose();
        return flag;
    }

    public int run(out int num, string sprocName, SqlParameter[] parameters)
    {
        Debug.Assert(sproc == null);
        sproc = new StoredProcedure(sprocName, parameters);
        int flag = sproc.Run(out num);
        this.ErrorMessage = sproc.ErrorMessage;
        sproc.Dispose();
        return flag;
    }

    public int run(DataTable table, string sprocName, SqlParameter[] parameters)
    {
        Debug.Assert(sproc == null);
        sproc = new StoredProcedure(sprocName, parameters);
        int flag = sproc.Run(table);
        this.ErrorMessage = sproc.ErrorMessage;
        sproc.Dispose();
        return flag;
    }
}